home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / MM2_DEV / S / MOS / XBIOS.D < prev    next >
Encoding:
Modula Definition  |  1990-10-24  |  13.5 KB  |  374 lines

  1. DEFINITION MODULE XBIOS;
  2.  
  3. (*
  4.  * XBIOS-Definition nach TDI V3.00
  5.  *
  6.  * Die engl. Dokumentation stammt von Paul Curtis (TDI).
  7.  *)
  8.  
  9. FROM SYSTEM IMPORT BYTE, WORD, LONGWORD, ADDRESS;
  10.  
  11. TYPE
  12.  
  13.   (* InitMouse *)
  14.   MouseType = (DisableMouse,
  15.                RelativeMouse,
  16.                AbsoluteMouse,
  17.                UnusedMouse,
  18.                KeycodeMouse);
  19.  
  20.   ParamBlk = RECORD
  21.                topMode: (OriginBottom, OriginTop);
  22.                buttons: BYTE;
  23.                xParam: BYTE;
  24.                yParam: BYTE;
  25.                (* for AbsoluteMouse mode only: *)
  26.                xMax: CARDINAL;
  27.                yMax: CARDINAL;
  28.                xinitial: CARDINAL;
  29.                yInitial: CARDINAL;
  30.              END;
  31.  
  32.   Palette = ARRAY [0..15] OF CARDINAL;
  33.  
  34.  
  35.   FlowFlavor = (NONE, XONXOFF, RTSCTS, XONXOFFRTSCTS);
  36.  
  37.   SerialDevice = (RS232, Keyboard, MIDI);
  38.  
  39.   SerialSpeed = (BPS19200, BPS9600, BPS4800, BPS3600, BPS2400, BPS2000,
  40.                  BPS1800,  BPS1200, BPS600,  BPS300,  BPS200,  BPS150,
  41.                  BPS134,   BPS110,  BPS75,   BPS50);
  42.  
  43.  
  44.   IORECPTR = POINTER TO IOREC;
  45.  
  46.   IOREC = RECORD
  47.             ibuf: ADDRESS;       (* pointer to buffer *)
  48.             ibufsize: CARDINAL;  (* buffer size *)
  49.             ibufhd: CARDINAL;    (* head index *)
  50.             ibuftl: CARDINAL;    (* tail index *)
  51.             ibuflow: CARDINAL;   (* low water mark *)
  52.             ibufhi: CARDINAL;    (* high water mark *)
  53.           END;
  54.  
  55.  
  56.   PrtConfig = (DaisyWheel,    (* dot/daisy *)
  57.                Monochrome,    (* colour/mono *)
  58.                EpsonPrinter,  (* Atari/Epson *)
  59.                Final,         (* draft/final *)
  60.                RS232Port,     (* parallel/RS232 *)
  61.                SingleSheet,   (* form-feed/single sheet *)
  62.                PC6, PC7, PC8, (* unused: *)
  63.                PC9, PC10, PC11,
  64.                PC12, PC13, PC14,
  65.                PC15);
  66.  
  67.   PrtConfigSet = SET OF PrtConfig;
  68.  
  69. CONST
  70.   NoAlter = PrtConfigSet{DaisyWheel..PC15}; (* passed to ConfigurePrinter *)
  71.  
  72.  
  73. TYPE
  74.   KeyTransPtr = POINTER TO KeyTrans;
  75.  
  76.   KeyTrans = ARRAY [0..127 (* eigentlich: 0..132! *)] OF BYTE;
  77.  
  78.   KeyTablePtr = POINTER TO KeyTable;
  79.  
  80.   KeyTable = RECORD
  81.                unshift: KeyTransPtr;
  82.                shift: KeyTransPtr;
  83.                capslock: KeyTransPtr;
  84.              END;
  85.  
  86. CONST
  87.  
  88.   (* resolutions for GetScreenResolution and SetScreen *)
  89.   Low    = 0;
  90.   Medium = 1;
  91.   High   = 2;
  92.  
  93.  
  94.   (* normal value given for virgin floppies *)
  95.   VirginMedia = 0E5E5H;
  96.  
  97.  
  98. TYPE
  99.  
  100.   Timer = (TimerA, TimerB, TimerC, TimerD);
  101.  
  102.   KBVectorPtr = POINTER TO KBVector;
  103.  
  104.   KBVector = RECORD
  105.                midi: ADDRESS;      (* MIDI input *)
  106.                kbderr: ADDRESS;    (* keyboard error *)
  107.                midierr: ADDRESS;   (* MIDI error *)
  108.                statvec: ADDRESS;   (* ikdb status packet *)
  109.                mousevec: ADDRESS;  (* mouse packet *)
  110.                clockvec: ADDRESS;  (* clock packet *)
  111.                joyvec: ADDRESS;    (* joystick packet *)
  112.              END;
  113.  
  114.  
  115. PROCEDURE InitMouse(type: MouseType; VAR param: ParamBlk; vec: ADDRESS);
  116.   (* initialise mouse packet handler. *)
  117.  
  118. PROCEDURE ScreenPhysicalBase(): ADDRESS;
  119.   (* get the screen's physical base address at beginning of next vblank. *)
  120.  
  121. PROCEDURE ScreenLogicalBase(): ADDRESS;
  122.   (* get the screen's logical (GSX) base address. *)
  123.  
  124. PROCEDURE GetResolution(): INTEGER;
  125.   (* return the screen's current resolution
  126.      0: low, 1: medium, 2: high *)
  127.  
  128. PROCEDURE SetScreenBase(logLoc, physLoc: ADDRESS; rez: INTEGER);
  129.   (* set screen base address and resolutions.
  130.      logLoc: new logical screen location.
  131.      physLoc: new physical screen resolution.
  132.      rez: new resolution.
  133.      NOTE: specifying -1 for any of the above will not change the
  134.              current value. *)
  135.  
  136. PROCEDURE SetPalette(VAR palette: Palette);
  137.   (* set the contents of the hardware palette register. *)
  138.  
  139. PROCEDURE SetColour(colourNum, colour: CARDINAL): CARDINAL;
  140.   (* set the colour of a palette table entry.
  141.      coluorNum: the palette entry to set colour of.
  142.      coluor: the new colour.
  143.      returns: the old value of the palette entry. *)
  144.  
  145. PROCEDURE FloppyRead(buf: ADDRESS; drive: CARDINAL;
  146.                      sector, track, side: CARDINAL;
  147.                      count: CARDINAL): INTEGER;
  148.   (* read floppy disk sector(s) into buffer.
  149.      buf: the buffer origin for the data.
  150.      drive: 0 => A:, 1 => B:
  151.      sector: sector number to start read from, normally 1..9.
  152.      track: the track to seek to.
  153.      side: the side to select.
  154.      count: the number of sectors to read.
  155.      returns: 0 => no error, otherwise DOS error code. *)
  156.  
  157. PROCEDURE FloppyWrite(buf: ADDRESS; drive: CARDINAL;
  158.                       sector, track, side: CARDINAL;
  159.                       count: CARDINAL): INTEGER;
  160.   (* write buffer to floppy disk sector(s).
  161.      parameters as for FloppyRead, except data is written from the buffer.
  162.      returns: 0 => no error, otherwise DOS error code. *)
  163.  
  164. PROCEDURE FloppyFormat(buf: ADDRESS; drive: CARDINAL;
  165.                        spt, track, side: CARDINAL;
  166.                        interleave, virgin: CARDINAL): INTEGER;
  167.   (* format a floppy disk track.
  168.      buf: buffer large enough to hold bit image of a track (8K for 9 spt)
  169.      drive: the drive to format, 0 => A:, 1 => B:
  170.      spt: the number of sectors per track, normally 9
  171.      track: the track to format, 0 through 79.
  172.      side: the side to format, 0 or 1.
  173.      interleave: the interleave factor, normally 1.
  174.      virgin: the word fill value for new sectors.
  175.      returns: 0 => no error, otherwise DOS error code.
  176.      note: on return buf holds zero terminated list of sectors that would
  177.            not format. *)
  178.  
  179. PROCEDURE MIDIWS(VAR string: ARRAY OF BYTE; len: CARDINAL);
  180.   (* write a string of characters to the MIDI port.
  181.      str: the string to write.
  182.      len: the number of characters to write - 1. *)
  183.  
  184. PROCEDURE MFPint(intNo: CARDINAL; vector: PROC);
  185.   (* set MFP interrupt vector.
  186.      intNo: the MFP interrupt vector to set.
  187.      vector: the interrupt handler code. *)
  188.  
  189. PROCEDURE IORec(dev: SerialDevice): IORECPTR;
  190.   (* return pointer to serial device IO record.
  191.      NOTE: for the RS232 device, an output record immediately follows the
  192.              input record returned by this function. It may be accessed by:
  193.            VAR x: IORECPTR;
  194.            x := IORECPTR(LONGCARD(IORec(RS232))+LONGCARD(TSIZE(IORec))); *)
  195.  
  196. PROCEDURE ConfigureRS232(speed: SerialSpeed;
  197.                          flowctl: FlowFlavor;
  198.                          ucr, rsr, tsr, scr: INTEGER);
  199.   (* configure RS232 port.
  200.      speed: the new RS232 speed.
  201.      flowctl: the handshaking used.
  202.      ucr, rsr, tsr, scr: set the appropriate 68901 registers. *)
  203.  
  204. PROCEDURE SetKeyTable(VAR unshift, shift, capslock: KeyTransPtr): KeyTablePtr;
  205.   (* set pointers to keyboard translation tables. *)
  206.  
  207. PROCEDURE Random(): LONGCARD;
  208.   (* return a random number. *)
  209.  
  210. PROCEDURE PrototypeBootSector(buf: ADDRESS; serialNo: LONGINT;
  211.                               disktype: INTEGER; execFlag: INTEGER);
  212.   (* prototype an image of a boot sector.
  213.      buf: the buffer to put the image into. (512 bytes)
  214.      serialNo: -1 => leave boot sector serial number unchanged.
  215.                00000000..00FFFFFF => new serial number for disk.
  216.                01000000..FFFFFFFE => generate random serial number.
  217.      disktype: -1 => leave information alone.
  218.                 0 = 40 tracks, SS (180K)
  219.                 1 = 40 tracks, DS (360K)
  220.                 2 = 80 tracks, SS (360K)
  221.                 3 = 80 tracks, DS (720K)
  222.      execFlag: 1 => bootable, 0 => non-bootable, -1 => leave alone. *)
  223.  
  224. PROCEDURE FloppyVerify(buf: ADDRESS; drive: CARDINAL;
  225.                        sector, track, side: CARDINAL;
  226.                        count: CARDINAL): INTEGER;
  227.   (* verify floppy disk sectors are readable.
  228.      parameters as for FloppyRead, except buffer must br 1024 bytes long. *)
  229.  
  230. PROCEDURE ScreenDump;
  231.   (* dump screen to printer. *)
  232.  
  233. PROCEDURE ConfigureCursor(rate, attrib: INTEGER): INTEGER;
  234.   (* configure cursor blink rate and attributes.
  235.      rate: based on video scan rate; -1 => no change.
  236.      attrib: 0 => flash, 1 => steady, -1 => no change.
  237.      returns: hi byte = old blink rate, lo byte = old attributes. *)
  238.  
  239. PROCEDURE SetDateTime(datetime: LONGCARD);
  240.   (* set the keyboard date and time.
  241.      datetime: DOS format date & time; hi word = date, lo word = time. *)
  242.  
  243. PROCEDURE GetDateTime(): LONGCARD;
  244.   (* get the date and time.
  245.      returns: DOS format date & time. *)
  246.  
  247. PROCEDURE BiosKeys;
  248.   (* restore keymappings to power up settings *)
  249.  
  250. PROCEDURE KeyboardWS(VAR str: ARRAY OF BYTE; len: CARDINAL);
  251.   (* write string to intelligent keyboard.
  252.      str: the string to write.
  253.      len: the number of characters to write - 1. *)
  254.  
  255. PROCEDURE DisableInterrupt(intNo: CARDINAL);
  256.   (* disable given 68901 interrupt. *)
  257.  
  258. PROCEDURE EnableInterrupt(intNo: CARDINAL);
  259.   (* enable given 68901 interrupt. *)
  260.  
  261. PROCEDURE GIRead(regno: CARDINAL): CARDINAL;
  262.   (* read register on the sound chip.
  263.      regno: the register number to read.
  264.      returns: data in the register. *)
  265.  
  266. PROCEDURE GIWrite(regno, data: CARDINAL);
  267.   (* write register on the sound chip.
  268.      regno: the register number to write.
  269.      data: the data to write to the register. *)
  270.  
  271. PROCEDURE GIOffBit(bitno: CARDINAL);
  272.   (* set a bit in the port A register to zero.
  273.      bitno: the bit number to set to zero. *)
  274.  
  275. PROCEDURE GIOnBit(bitno: CARDINAL);
  276.   (* set a bit in the port A register to one.
  277.      bitno: the bit number to set to one. *)
  278.  
  279. PROCEDURE SetTimerInterrupt(timer: Timer; control, data: CARDINAL; vec: PROC);
  280.   (* set an interrupt handler for timer.
  281.      timer: the timer to install interrupt handler for.
  282.      control: timer's control register setting.
  283.      data: byte put into timer's data register.
  284.      vec: the interrupt procedure. *)
  285.  
  286. PROCEDURE DoSound(x: ADDRESS);
  287.   (* set sound daemon's "program counter".
  288.      x: the new program counter; program is a sequence of bytes of the
  289.         form:
  290.         { <opcode> <operand1> [<operand2> <operand3> ] }
  291.         00 - 0F   sound register <opcode> := <operand1>
  292.         80        temporary register := <operand1>
  293.         81        sound register <operand1> := temporary register
  294.                   INC(temporary register,<operand2>) (*signed*)
  295.                   IF temporary register = <operand3> THEN
  296.                     go to next instuction
  297.                   ELSE
  298.                     wait for next update
  299.                     repeat instruction
  300.                   END
  301.         82 - FF   IF <operand1> = 0 THEN stop sound daemon
  302.                   ELSE set next update to <operand1> 50Hz ticks time
  303.                   END
  304.         e.g. data for "bell" type sound:
  305.         00 34 01 00 02 00 03 00 04 00 05 00 06 00 07 FE 08 10 09 00
  306.         0A 00 0B 00 0C 10 0D 09 FF 00
  307. *)
  308.  
  309. PROCEDURE ConfigurePrinter(config: PrtConfigSet): PrtConfigSet;  (*0.10a*)
  310.   (* configure printer.
  311.      config: the new printer configuration.
  312.      returns: old printer configuration.
  313.      NOTE: ConfigurePrinter(NoAlter) does not alter the old setting. *)
  314.  
  315. PROCEDURE KeyboardVectors(): KBVectorPtr;
  316.   (* return pointer to keyboard vector table. *)
  317.  
  318. PROCEDURE KeyboardRate(initial, repeat: INTEGER): CARDINAL;
  319.   (* set keyboard repeat rate and delay.
  320.      initial: -1 => no change, otherwise initial delay, 50Hz.
  321.      repeat: -1 => no change, otherwise repeat rate, 50Hz.
  322.      returns: hi byte = old initial delay, lo byte = old repeat rate. *)
  323.  
  324. PROCEDURE VSync;
  325.   (* wait for next vertical blank interrupt. *)
  326.  
  327. PROCEDURE SuperExec(Code: PROC);
  328.   (* Run code in supervisor mode with supervisor stack.
  329.      Code: The code to run in supervisor mode, terminated with RTS.
  330.      Note: The code is run with the supervisor stack. Do NOT attempt
  331.            to allocate large amounts of local data as the supervisor
  332.            stack will overflow. Note that the code in the "Code" proc
  333.            must have stack checking turned off (with a $S- directive)
  334.            otherwise a "stack overflow" error will be generated on entry
  335.            to the procedure. *)
  336.  
  337. PROCEDURE PuntAES;
  338.   (* Throws away the GEM AES, freeing up memory. A re-boot will always be
  339.      performed after this call (unless AES is in ROM) *)
  340.  
  341. PROCEDURE BlitMode (flag: INTEGER): BITSET;
  342.   (* Is only available on Blitter TOS (version 1.2) and higher! *)
  343.  
  344. PROCEDURE FlopRate (drive: CARDINAL; rate: INTEGER): INTEGER;
  345.   (* Returns current seek rate of the floppy disk if -1 is passed to 'rate'.
  346.      Otherwise the new 'rate' value is set.
  347.      Works with ALL TOS-versions!
  348.        drive: 0 => A:, 1 => B:, other values are not allowed!
  349.        rate: -1 -> return current rate, 0: 6ms, 1: 12ms, 2: 2ms, 3: 3ms  *)
  350.  
  351. (*
  352.  * Die folgenden Funktionen sind nur auf einem Atari TT verfügbar:
  353.  *)
  354.  
  355. PROCEDURE Bconmap (devNo: WORD): LONGWORD;
  356.  
  357. PROCEDURE DMAread (sector: LONGCARD; count: CARDINAL; buffer: ADDRESS;
  358.                    devNo: CARDINAL): INTEGER;
  359. PROCEDURE DMAwrite (sector: LONGCARD; count: CARDINAL; buffer: ADDRESS;
  360.                    devNo: CARDINAL): INTEGER;
  361.  
  362. PROCEDURE NVMaccess (op, start, count: CARDINAL; buffer: ADDRESS): INTEGER;
  363.  
  364. PROCEDURE EsetShift (shftMode: WORD): WORD;
  365. PROCEDURE EgetShift (): WORD;
  366. PROCEDURE EsetBank (bankNum: INTEGER): INTEGER;
  367. PROCEDURE EsetColor (colorNum, color: INTEGER): INTEGER;
  368. PROCEDURE EsetPalette (colorNum, count: INTEGER; palettePtr: ADDRESS);
  369. PROCEDURE EgetPalette (colorNum, count: INTEGER; palettePtr: ADDRESS);
  370. PROCEDURE EsetGray (switch: INTEGER): INTEGER;
  371. PROCEDURE EsetSmear (switch: INTEGER): INTEGER;
  372.  
  373. END XBIOS.
  374.